package com.aote.rs.db;

import javax.servlet.http.HttpServletRequest;
import javax.ws.rs.Path;
import javax.ws.rs.PathParam;
import javax.ws.rs.core.Context;

import com.browsesoft.EntityManager;
import com.browsesoft.user.User;

public class RestUser {

	@Path("user/{id}")
	public User getUser(@PathParam("id")
	String id, @Context
	HttpServletRequest request) {
		User user = null;
		if (id.toLowerCase().equals("loginuser")) {
			user = (User) request.getSession().getAttribute("loginUser");
		} else {
			user = (User) EntityManager.getInstance().getUserById(id);
		}
		return user;
	}
}
